﻿using System;
using System.Collections.Generic;
using System.Linq;
using Abp.Linq.Extensions;
using System.Text;
using Abp.Application.Services;
using Abp.Collections.Extensions;
using Abp.Domain.Repositories;
using Abp.Extensions;
using Aug.iot.People.Dtos;

namespace Aug.iot.People
{
    public class PersonAppService : AsyncCrudAppService<Person, PersonDto, Guid, PagedPersonResultRequestDto, CreatePersonDto, PersonDto>, IPersonAppService
    {
        public PersonAppService(IRepository<Person, Guid> repository)
            :base(repository)
        { }

        protected override IQueryable<Person> CreateFilteredQuery(PagedPersonResultRequestDto input)
        {
            return Repository.GetAll()
                .WhereIf(!input.Keyword.IsNullOrEmpty(), x => x.Name.Contains(input.Keyword));
        }
    }
}
